package com.itsm.controller;

import com.itsm.entity.Process;
import com.itsm.service.ProcessEngineerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
public class ProcessEngineerController {

    @Autowired
    private ProcessEngineerService processEngineerService;


    /**
     * 负责人查询已所有工单
     * @param
     * @return
     */
    @GetMapping("/respaProAll")
    public List<Process> respaAll(HttpServletRequest request,String userName) {
        String name = (String) request.getSession().getAttribute("name");
        List<Process> list = processEngineerService.selectAll(name,userName);
        return list;
    }

    /**
     * 查询工单
     * @param
     * @return
     */
    @GetMapping("/respaPro")
    public List<Process> getRespa1(HttpServletRequest request,Integer state,Integer is) {
        String name = (String) request.getSession().getAttribute("name");
        List<Process> list = processEngineerService.selectListRespa(name,state,is);
        return list;
    }

    /**
     * 查询工单,未评论
     * @param
     * @return
     */
    @GetMapping("/respaProRate")
    public List<Process> getRespaRate(HttpServletRequest request,Integer state,Integer is) {
        String name = (String) request.getSession().getAttribute("name");
        List<Process> list = processEngineerService.selectListRespaRate(name,state,is);
        return list;
    }


    /**
     * 查询工单,已评论
     * @param
     * @return
     */
    @GetMapping("/respaProRate1")
    public List<Process> getRespaRate1(HttpServletRequest request,Integer state,Integer is) {
        String name = (String) request.getSession().getAttribute("name");
        List<Process> list = processEngineerService.selectListRespaRate1(name,state,is);
        return list;
    }


    @GetMapping("respaRateNo")
    public List<Process> respaRateNo(HttpServletRequest request,Integer state,Integer is){
        String name = (String) request.getSession().getAttribute("name");
        return processEngineerService.selectRateNo(name,state,is);
    }

    @GetMapping("respaRate")
    public List<Process> assignRate(HttpServletRequest request,Integer state,Integer is){
        String name = (String) request.getSession().getAttribute("name");
        return processEngineerService.selectRate(name,state,is);
    }

}
